package com.isunland.managesystem.adapter;

import android.support.annotation.NonNull;
import android.view.View;
import android.widget.TextView;
import butterknife.BindView;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BaseButterKnifeAdapter;
import com.isunland.managesystem.base.BaseVolleyActivity;
import com.isunland.managesystem.entity.RSealsUseApp;
import com.isunland.managesystem.utils.MyDateUtil;
import com.isunland.managesystem.utils.MyStringUtil;
import com.isunland.managesystem.utils.MyUtils;
import java.util.ArrayList;

/**
 * 对象功能:
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: wangyanan
 * 创建时间: 2017/4/5 15:01
 */

public class SealUseAdapter extends BaseButterKnifeAdapter<RSealsUseApp> {
  @SuppressWarnings("unused")
  public SealUseAdapter(BaseVolleyActivity context, ArrayList<RSealsUseApp> objects) {
    super(context, objects);
  }

  @Override protected int setLayoutId() {
    return R.layout.adapter_new_list_1;
  }

  @NonNull @Override protected BaseViewHolder initHolder(View convertView) {
    return new ViewHolder(convertView);
  }

  @Override protected void initView(RSealsUseApp item, BaseViewHolder baseHolder, int position) {
    ViewHolder holder = (ViewHolder) baseHolder;
    //noinspection deprecation
    holder.ivLogo.setText(MyStringUtil.substring(item.getSealsType(), 0, 2));
    holder.tvContent1.setText(item.getApplyText());
    holder.tvBottom.setText(MyStringUtil.connect(item.getRegStaffName(), MyStringUtil.SEPEREATE,
        MyDateUtil.format(item.getRegDate(), MyDateUtil.TYPE_DATE)));
    MyUtils.switchDataStutus(context, holder.tvIndex, item.getDataStatus());
  }

  protected class ViewHolder extends BaseViewHolder {
    @BindView(R.id.iv_logo) TextView ivLogo;
    @BindView(R.id.tv_content1) TextView tvContent1;
    @BindView(R.id.tv_bottom) TextView tvBottom;
    @BindView(R.id.tv_index) TextView tvIndex;

    ViewHolder(View view) {
      super(view);
    }
  }
}
